import loadable from '@/utils/loadable'

// 引入一级路由
const Login = loadable(() => import('@/views/Login/login'));
const Register = loadable(() => import('@/views/Register/register'));
const HomeIndex = loadable(() => import('@/views/HomeIndex/index'));
// 引入二级路由
const Score = loadable(() => import('@/views/HomeIndex/pages/Score/index'));
const StudentHome = loadable(() => import('@/views/HomeIndex/pages/StudentHome'));
const TeacherHome = loadable(() => import('@/views/HomeIndex/pages/TeacherHome'));
const Mine = loadable(() => import('@/views/HomeIndex/pages/Mine'));

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/homeIndex',
    component: HomeIndex,
    children: [
      {
        path: '/',
        redirect: '/homeIndex/teacher'
      },
      {
        path: '/homeIndex/score',
        component: Score
      },
      {
        path: '/homeIndex/student',
        component: StudentHome
      },
      {
        path: '/homeIndex/teacher',
        component: TeacherHome
      },
      {
        path: '/homeIndex/mine',
        component: Mine
      }
    ]
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/register',
    component: Register
  }
];

export default routes;
